import request from '@/utils/request'

// 查询材料列表
export function listMaterial(query) {
  return request({
    url: '/basic/material/list',
    method: 'get',
    params: query
  })
}

// 查询材料详细
export function getMaterial(materialId) {
  return request({
    url: '/basic/material/' + materialId,
    method: 'get'
  })
}

// 新增材料
export function addMaterial(data) {
  return request({
    url: '/basic/material',
    method: 'post',
    data: data
  })
}

// 修改材料
export function updateMaterial(data) {
  return request({
    url: '/basic/material',
    method: 'put',
    data: data
  })
}

// 删除材料
export function delMaterial(materialId) {
  return request({
    url: '/basic/material/' + materialId,
    method: 'delete'
    
  })
}

// 查询材料类型列表
export function listType(query) {
  return request({
    url: '/basic/type/list',
    method: 'get',
    params: query
  })
}

// 查询材料类型下拉树结构
export function typeTreeSelect() {
  return request({
    url: '/basic/material/typeTree',
    method: 'get'
  })
}


// 修改材料状态
export function changeMaterialStatus(materialId,status) {
  const data = {
    materialId,
    status
  }
  return request({
    url: '/basic/material/changeStatus',
    method: 'put',
    data: data
  })
}

export function getTypeParentId(materialTypeId){
  return request({
    url: 'basic/material/getTypeParentId',
    method: 'get',
    data: materialTypeId
  })
}


// 查询材料品牌列表
export function listBrand(query) {
  return request({
    url: '/basic/brand/list',
    method: 'get',
    params: query
  })
}
